package com.genentech.flexigraph;
/*
 * Class by Jeff Milton, except where otherwise noted.
 */
public class RealPoint implements java.io.Serializable {

	public float x, y;
	public String label = "";
	protected boolean selected = false;

	public RealPoint() {
		this.x = 0;
		this.y = 0;
	}

	public RealPoint(float _x, float _y) {
		this.x = _x;
		this.y = _y;
	}

	public RealPoint(float _x, float _y, String _label) {
		this(_x, _y);
		this.label = _label;
	}

	public void paint(Graphics g, Grid o) {
		// g.setColor(Color.BLUE);
		// g.drawString(""+ this.x, o.X(this.x), o.Y(this.y));
		g.fillOval(o.X(this.x), o.Y(this.y), 1, 2);
	}

	public boolean isPoint(float _x, float _y, Grid _grid) {
		if (x == _x && this.y == _y)
			return true;
		else
			return false;
	}

	public void update(float _x, float _y) {
		this.x = _x;
		this.y = _y;
	}

	public float getX() {
		return x;
	}

	public float getY() {
		return y;
	}

	public void setX(float _x) {
		x = _x;
	}

	public void setY(float _y) {
		y = _y;
	}

	public void select() {
		this.selected = true;
	}

	public void deselect() {
		this.selected = false;
	}

	public boolean isSelected() {
		return selected;
	}

	public String toString() {
		return "" + x + ", " + y;
	}

}
